package icu.sehnen.fitness.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import icu.sehnen.fitness.entity.Coach;
import icu.sehnen.fitness.mapper.CoachMapper;
import icu.sehnen.fitness.service.ICoachService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author sehnen
 * @since 2021-04-26
 */
@Service
public class CoachServiceImpl extends ServiceImpl<CoachMapper, Coach> implements ICoachService {
    @Autowired
    CoachMapper coachMapper;


    @Override
    public List<Coach> findAll(String query) {
        if(query == null){
            query ="";
        }
        QueryWrapper<Coach> queryWrapper=new QueryWrapper<>();
        queryWrapper.like("name",query);
        return  coachMapper.selectList(queryWrapper);

    }
}
